//
//  ViewController.swift
//  swiftDemo
//
//  Created by ChuanQi on 2019/5/5.
//  Copyright © 2019年 ChuanQi. All rights reserved.
//

import UIKit

class ViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.white;
        self.createTabbar();
    }
    
    func createTabbar() {
        let homeVC = HomeViewController.init();
        let chatVC = ChatViewController.init();
        let aboutVC = AboutViewController.init();
        let homeTabbarItem = UITabBarItem.init(title: "首页", image:UIImage.init(named: "tab_home_note")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal), selectedImage: UIImage.init(named: "tab_home_selected")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal));
        let chatTabbarItem = UITabBarItem.init(title: "发现", image:UIImage.init(named: "tab_dynamic_note")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal), selectedImage: UIImage.init(named: "tab_dynamic_selected")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal));
        let aboutTabbarItem = UITabBarItem.init(title: "我的", image:UIImage.init(named: "tab_mine_note")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal), selectedImage: UIImage.init(named: "tab_mine_selected")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal));
        self.tabBar.tintColor = UIColor.red;
        homeVC.tabBarItem = homeTabbarItem;
        chatVC.tabBarItem = chatTabbarItem;
        aboutVC.tabBarItem = aboutTabbarItem;
        
        let homeNaVC = UINavigationController.init(rootViewController: homeVC);
        let chatNaVC = UINavigationController.init(rootViewController: chatVC);
        let aboutNaVC = UINavigationController.init(rootViewController: aboutVC);
        self.viewControllers = [homeNaVC,chatNaVC,aboutNaVC]
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}

